#pragma once

#include "utils.h"
#include "floatfann.h"
#include "fann_cpp.h"
#include <QtCore/QObject>

/*----------------------------------------------------------------------------*/

class CNetworkManager
	:	public QObject
{
	Q_OBJECT

/*----------------------------------------------------------------------------*/

public:

/*----------------------------------------------------------------------------*/

	CNetworkManager();
	
	~CNetworkManager();

/*----------------------------------------------------------------------------*/
	
	void CreateNetwork( const UIntV& _neuronsNumber );

	void TrainNetwork( const ImageV& _images, int _epoch, double _threshold );

	bool NetworkExists() const;

	const std::string& GetNetworkFileName() const;

	void SaveNetwork( const std::string& _fileName );

	void LoadNetwork( const std::string& _fileName );

	void CloseNetwork();

	char ClassifyImage( CImage& _image );

/*----------------------------------------------------------------------------*/

private:

/*----------------------------------------------------------------------------*/

	FANN::neural_net* m_net;	

	std::string m_networkFileName;

	bool m_isTerminated;


/*----------------------------------------------------------------------------*/

signals:

/*----------------------------------------------------------------------------*/

	void Progress( const QString& );

/*----------------------------------------------------------------------------*/

public slots:

/*----------------------------------------------------------------------------*/

	void Terminate();

/*----------------------------------------------------------------------------*/

};

/*----------------------------------------------------------------------------*/
